import 'package:flutter/material.dart';
class InheritedTestModel {
  final int count;
  const InheritedTestModel(this.count);
}

class InheritedWidgetContext extends InheritedWidget {
  final InheritedTestModel inheritedTestModel;
  final Function incerment;
  final Function reduce;

  const InheritedWidgetContext({
    Key? key,
    required this.inheritedTestModel,
    required this.incerment,
    required this.reduce,
    required Widget child,
  }) : super(key: key, child: child);

  static InheritedWidgetContext? of(BuildContext context) {
    return context.dependOnInheritedWidgetOfExactType<InheritedWidgetContext>();
  }

  // static InheritedWidgetContext? of(BuildContext context) {
  //   return context.dependOnInheritedWidgetOfExactType<InheritedWidgetContext>();
  // }
  @override
  bool updateShouldNotify(InheritedWidgetContext oldWidget) {
    return inheritedTestModel!=oldWidget.inheritedTestModel;
  }
}





